Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify TransportAddress #20798

Merged
merged 2 commits into from Oct 7, 2016
Merged

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Oct 7, 2016

since TransportAddress is now final we can simplify it's interface a bit
and remove methods that are only used in tests or are plain delegates.

since TransportAddress is now final we can simplify it's interface a bit
and remove methods that are only used in tests or are plain delegates.
@s1monw s1monw added review :Distributed/Network Http and internode communication implementations v6.0.0-alpha1 >breaking-java labels Oct 7, 2016
Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a minor nit, it doesn't matter to me if you address it or not. LGTM.

@@ -144,8 +145,10 @@ static void log(final Logger logger, final String error) {
*/
// visible for testing
static boolean enforceLimits(BoundTransportAddress boundTransportAddress) {
return !(Arrays.stream(boundTransportAddress.boundAddresses()).allMatch(TransportAddress::isLoopbackOrLinkLocalAddress) &&
boundTransportAddress.publishAddress().isLoopbackOrLinkLocalAddress());
Predicate<TransportAddress> isLoopbackOrLinkLocalAddress = (t) -> t.address().getAddress().isLinkLocalAddress()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parentheses around t are unnecessary.

"open sesame", emptyMap());
ReindexRequestBuilder request = ReindexAction.INSTANCE.newRequestBuilder(client()).source("source").destination("dest")
.setRemoteInfo(remote);
assertThat(request.get(), matcher().created(1));
}

public void testReindexSendsHeaders() throws Exception {
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkstyle is unhappy with this.

@@ -107,7 +107,7 @@ public void testReindexSendsHeaders() throws Exception {
}

public void testReindexWithoutAuthenticationWhenRequired() throws Exception {
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkstyle is unhappy with this.

@@ -125,7 +125,7 @@ public void testReindex() throws Exception {
public void testReindexFromRemote() throws Exception {
NodeInfo nodeInfo = client().admin().cluster().prepareNodesInfo().get().getNodes().get(0);
TransportAddress address = nodeInfo.getHttp().getAddress().publishAddress();
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkstyle is unhappy with this.

@s1monw s1monw merged commit 7452028 into elastic:master Oct 7, 2016
@s1monw s1monw deleted the simplify_transport_address branch October 7, 2016 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>breaking-java :Distributed/Network Http and internode communication implementations v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants